package cn.ctbu.simple_score_manage.dao;


import cn.ctbu.simple_score_manage.domain.Teacher;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;


@Mapper
public interface ITeacherDao extends BaseMapper<Teacher> {
    /**
     * 通过课程编号查询所有修这门课程的学生的信息
     * @param courseNo
     * @return
     */
    @Select("<script>" + "select tb_student.`no` as studentNo, tb_score.id as scoreId,tb_student.`name` as 'name',tb_score.score as 'score',tb_course.`name`as \"courseName\" FROM tb_score,tb_student,tb_course where tb_score.student_no = tb_student.`no`" +
            "and tb_score.course_no = tb_course.`no`" +
            "and tb_score.course_no=#{courseNo};" +
            "</script>")
    List<Map<String, String>> selectScoreByCourseNo(@Param("courseNo") String courseNo);
}
